Repository navigation
Decode inland AIS draught in centimetres - #268
Open
Solarboaters wants to merge 1 commit into
Open
Solarboaters wants to merge 1 commit into
Solarboaters wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change correcting inland AIS draught decoding from centimetres to metres.
No open issues 🎉
What changed in this PR
Corrects inland AIS 8:200:10 draught decoding from centimetres to metres, addressing #193 while preserving length and beam scaling.
Changes:
- Divides the encoded draught by 100 instead of 10.
- Adds C++ and Python regression coverage for 0, 1, 123, and 2000 cm, with checks that other decoded fields remain unchanged.
| File | Description |
|---|---|
test/inland_draught_test.py |
Tests draught conversion through the Python binding using modified fixture bits. |
src/test/ais8_200_test.cpp |
Adds C++ regression cases for centimetre-based draught values. |
src/libais/ais8_200.cpp |
Corrects the draught conversion factor to produce metres. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #193. Thanks to @cookiemon for identifying the unit mismatch.
Inland AIS 8:200:10 encodes draught in centimetres. Dividing by ten makes a 1.23 m draught appear as 12.3 m. Divide by 100, leaving the decimetre scaling of length and beam unchanged. The field definition is in the Inland AIS specification.
Regression tests alter only the draught bits in an existing message fixture and exercise both the C++ decoder and Python binding at 0, 1, 123 and 2000 cm. The nonzero cases fail against the original implementation; all pass with the fix. All 94 Python tests and 30 CTest executables pass, with AddressSanitizer enabled for the C++ tests. Tested on Linux/Python 3.12; no live AIS receiver or vessel was tested.
Prepared with AI assistance.